Database applications typically provide multiple users with parallel access to stored data. A process associated with one user may request a temporary application lock on a database object in order to answer a business question, while simultaneously preventing other concurrent processes to access or change the data underlying the answer. For example, a first process may request an application lock on data representing stock availability in a warehouse, or on data representing remaining budget for a project. While the first process holds the lock, a second process requesting the same lock receives an error message indicating that another process currently holds the lock.
In some systems, a lock request may include a Wait parameter. The Wait parameter causes a failed lock request to be repeated after a fixed waiting time (e.g., 1 second). If the lock request fails after each of a specific number of iterations (e.g., 5), the above-mentioned error message is issued. However, if a lock becomes available while one request from a first process is waiting and a new request from a second process is received, the new request is granted, even though the new request is more recent than the request from the first process.